<?php
/*code here*/
/* Redirect user if they already logged */
if(Auth::hasAuth('current_user')){
    //$this->view->current_user = Auth::getAuth('current_user');

}
else{
    header('location: /');
}

    $auth = Auth::getAuth('current_user');
    $user_level_id = $auth['user_level_id'];
        // Allow User View
        functions::redirection_user($user_level_id);
/*code here(end)*/


$search = new Search();

if(isset($_GET['form_id'])){
	// $id = $_GET['id'];
	// $obj = array("condition"=>" AND wf.id = ". $id ." ");
	// $obj = json_decode(json_encode($obj),true);
	// $result = $search->getWorkflows("",0,$obj);
	// $countWorkflow = count(json_decode(setAdminViewer($result),true));
	// if($countWorkflow==0){
	// 	header("location:/user_view/home");
	// }
	$id = $_GET['form_id'];
	$obj = array("condition"=>" AND w.id = ". $id ." ");
	$obj = json_decode(json_encode($obj),true);
	$result = $search->getForms("",0,$obj);
	$countForm = count(json_decode(setAdminViewer($result),true));
	if($countForm==0){
		header("location:/user_view/home");
	}
}

$this->setLayout();